home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 June / Ahoy_Magazine_86-06_1986_Double_L.d64 / phone list < prev    next >
Text File  |  2022-10-26  |  2KB  |  72 lines

  1. ELECTRIC PHONE
  2.  
  3. by Captain COMAL
  4.  
  5. I'm late! I better call George. Drat!
  6. What's his last name? Klaverston. No.
  7. Calverson? Wait! Why bother? You have
  8. a computer. COMAL is good at
  9. searching for things. This program
  10. does it all for you: creates the data
  11. file, let's you enter names into it,
  12. and best of all - finds a phone
  13. number when you need it. And you
  14. don't have to remember the persons
  15. full name either!
  16.  
  17. The find routine is simple. It is
  18. really done all in one line using IN
  19. (see line 540). The nice thing is
  20. that IN looks over the entire string
  21. for a match! To find the name George
  22. Galveston you could ask for George
  23. and it would match. Or ask for Galv,
  24. ston, or just G. They all will match.
  25.  
  26. And keeping track of your disk files
  27. with COMAL is easy too. The STATUS
  28. command reports on the status of the
  29. disk drive (see line 380). We use it
  30. to see if opening the file was OK
  31. ("00"). The first time you run the
  32. program the data file will not be
  33. there, and the program detects this
  34. and starts it for you. COMAL watches
  35. all your files for you. Whenever you
  36. reach the end of a file it sets EOF
  37. (for End Of File) to TRUE. By using
  38. EOF in line 520 we make sure our
  39. program is not upset if it can't find
  40. the person requested.
  41.  
  42. Did you see the ZONE command in line
  43. 50? In BASIC your screen is set up
  44. with a default zone width of 10,
  45. which is nice, if you happen to need
  46. that specific setting. In COMAL, you
  47. can set the zone to be any number you
  48. wish (0 is the default for none).
  49. Line 50 sets the zone to 21, perfect
  50. for use with names up to 20
  51. characters long (which we set in line
  52. 20). Longer names then have the phone
  53. number on the next line (since two
  54. tabs of 21 is past the 40 character
  55. screen line).
  56.  
  57. Finally, look at the multiple choice
  58. system COMAL has. Lines 140 through
  59. 270 show the CASE structure. KEY$
  60. looks at the keyboard and returns the
  61. key you just pressed (if any). It is
  62. the basis of our CASE. When the key
  63. is an E (upper or lower case) the
  64. ENTER'NAME routine is executed. When
  65. it is F the program first asks for a
  66. piece of information (what to look
  67. for) and then calls the routine
  68. FIND'NAME to do the search. If none
  69. of the WHEN cases match, COMAL
  70. provides us with the OTHERWISE
  71. section. All quite readable.
  72.